<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    
    <form action="{:url('SlideItem/editPost')}" method="post" class="layui-form js-ajax-form margin-top-20">
        <div class="layui-card">
            <div class="layui-card-header">{:lang('ADMIN_SLIDEITEM_EDIT')}</div>
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('TITLE')}</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="post[title]" required value="{$result.title}" placeholder="{:lang('PLEASE_ENTER')}{:lang('TITLE')}"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('LINK')}</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="post[url]" value="{$result.url}" placeholder="{:lang('PLEASE_ENTER')}{:lang('LINK')}"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('description')}</label>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="post[description]" value="{$result.description}" placeholder="{:lang('PLEASE_ENTER')}{:lang('description')}"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('CONTENT')}</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="post[content]" rows="5" placeholder="{:lang('PLEASE_FILL_IN')}{:lang('CONTENT')}">{$result.content}</textarea>
                    </div>
                </div>
                
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('UPLOAD_IMAGE')}</label>
                
                    <div class="layui-input-block">
                        <div class="upload-image">
                            <input type="hidden" name="post[image]" id="thumb" value="{$result.image|default=''}">
                            <a href="javascript:uploadOneImage('{:lang('UPLOAD_IMAGE')}','#thumb');">
                                <if condition="empty($result['image'])">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="thumb-preview" width="135"/>
                                    <else/>
                                    <img src="{:cmf_get_image_preview_url($result['image'])}" id="thumb-preview"
                                         width="135"/>
                                </if>
                            </a>
                            <input type="button" class="layui-btn layui-btn-danger layui-btn-sm"
                                   onclick="$('#thumb-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumb').val('');return false;"
                                   value="{:lang('CANCEL_PICTURE')}">
                        </div>
                    </div>
                </div>
                <!-- 排序号 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">{:lang('SORT')}</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input" name="post[list_order]" value="{$result.list_order}">
                    </div>
                </div>
                <!-- 属性 -->
                <div class="layui-form-item">
                    <php>
                        $status_yes = ($result['status'] == 0) ? "checked" : "";
                    </php>
                    <label class="layui-form-label">{:lang('ATTRIBUTE')}</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="post[status]" title="{:lang('IS_HIDE')}" value="0"  {$status_yes}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="post[id]" value="{$result.id}"/>
                        <input type="hidden" name="post[slide_id]" value="{$slide_id}">
                        <if condition="cmf_auth_check(cmf_get_current_admin_id(), 'admin/SlideItem/editPost')">
                            <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('SAVE')}</button>
                        </if>
                        <a class="layui-btn layui-btn-primary" href="{:url('SlideItem/index',['slide_id'=>$slide_id])}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<include file="public@footer"/>
